<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>web2py.gluon.html</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;web2py ::
        <a href="web2py.gluon-module.html">Package&nbsp;gluon</a> ::
        Module&nbsp;html
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="web2py.gluon.html-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module html</h1><span class="codelink"><a href="web2py.gluon.html-pysrc.html">source&nbsp;code</a></span><br /><br />
This file is part of the web2py Web Framework Copyrighted by Massimo 
  Di Pierro &lt;mdipierro@cs.depaul.edu&gt; License: LGPLv3 
  (http://www.gnu.org/licenses/lgpl.html)<br /><br />

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.XmlComponent-class.html" class="summary-name">XmlComponent</a><br />
      Abstract root for all Html components
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.XML-class.html" class="summary-name">XML</a><br />
      use it to wrap a string that contains XML/HTML so that it will 
        not be escaped by the template
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.DIV-class.html" class="summary-name">DIV</a><br />
      HTML helper, for easy generating and manipulating a DOM 
        structure.
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.__TAG__-class.html" class="summary-name">__TAG__</a><br />
      TAG factory example:
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.HTML-class.html" class="summary-name">HTML</a><br />
      There are four predefined document type definitions.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.XHTML-class.html" class="summary-name">XHTML</a><br />
      This is XHTML version of the HTML helper.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.HEAD-class.html" class="summary-name">HEAD</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TITLE-class.html" class="summary-name">TITLE</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.META-class.html" class="summary-name">META</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.LINK-class.html" class="summary-name">LINK</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.SCRIPT-class.html" class="summary-name">SCRIPT</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.STYLE-class.html" class="summary-name">STYLE</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.IMG-class.html" class="summary-name">IMG</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.SPAN-class.html" class="summary-name">SPAN</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.BODY-class.html" class="summary-name">BODY</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.H1-class.html" class="summary-name">H1</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.H2-class.html" class="summary-name">H2</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.H3-class.html" class="summary-name">H3</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.H4-class.html" class="summary-name">H4</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.H5-class.html" class="summary-name">H5</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.H6-class.html" class="summary-name">H6</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.P-class.html" class="summary-name">P</a><br />
      Will replace ``\n`` by ``&lt;br /&gt;`` if the `cr2br` attribute
        is provided.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.B-class.html" class="summary-name">B</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.BR-class.html" class="summary-name">BR</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.HR-class.html" class="summary-name">HR</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.A-class.html" class="summary-name">A</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.EM-class.html" class="summary-name">EM</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.EMBED-class.html" class="summary-name">EMBED</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TT-class.html" class="summary-name">TT</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.PRE-class.html" class="summary-name">PRE</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.CENTER-class.html" class="summary-name">CENTER</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.CODE-class.html" class="summary-name">CODE</a><br />
      displays code in HTML with syntax highlighting.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.LABEL-class.html" class="summary-name">LABEL</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.LI-class.html" class="summary-name">LI</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.UL-class.html" class="summary-name">UL</a><br />
      UL Component.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.OL-class.html" class="summary-name">OL</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TD-class.html" class="summary-name">TD</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TH-class.html" class="summary-name">TH</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TR-class.html" class="summary-name">TR</a><br />
      TR Component.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.THEAD-class.html" class="summary-name">THEAD</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TBODY-class.html" class="summary-name">TBODY</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TFOOT-class.html" class="summary-name">TFOOT</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TABLE-class.html" class="summary-name">TABLE</a><br />
      TABLE Component.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.I-class.html" class="summary-name">I</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.IFRAME-class.html" class="summary-name">IFRAME</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.INPUT-class.html" class="summary-name">INPUT</a><br />
      INPUT Component

examples::

    &gt;&gt;&gt; INPUT(_type='text', _name='name', value='Max').xml()
    '&lt;input name=&quot;name&quot; type=&quot;text&quot; value=&quot;Max&quot; /&gt;'

    &gt;&gt;&gt; INPUT(_type='checkbox', _name='checkbox', value='on').xml()
    '&lt;input checked=&quot;checked&quot; name=&quot;checkbox&quot; type=&quot;checkbox&quot; value=&quot;on&quot; /&gt;'

    &gt;&gt;&gt; INPUT(_type='radio', _name='radio', _value='yes', value='yes').xml()
    '&lt;input checked=&quot;checked&quot; name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;yes&quot; /&gt;'

    &gt;&gt;&gt; INPUT(_type='radio', _name='radio', _value='no', value='yes').xml()
    '&lt;input name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;no&quot; /&gt;'

the input helper takes two special attributes value= and requires=.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.TEXTAREA-class.html" class="summary-name">TEXTAREA</a><br />
      example:
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.OPTION-class.html" class="summary-name">OPTION</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.OBJECT-class.html" class="summary-name">OBJECT</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.OPTGROUP-class.html" class="summary-name">OPTGROUP</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.SELECT-class.html" class="summary-name">SELECT</a><br />
      example:
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.FIELDSET-class.html" class="summary-name">FIELDSET</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.LEGEND-class.html" class="summary-name">LEGEND</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.FORM-class.html" class="summary-name">FORM</a><br />
      example:
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.BEAUTIFY-class.html" class="summary-name">BEAUTIFY</a><br />
      example::

    &gt;&gt;&gt; BEAUTIFY(['a', 'b', {'hello': 'world'}]).xml()
    '&lt;div&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;div&gt;a&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div&gt;b&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;font-weight:bold;&quot;&gt;hello&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;:&lt;/td&gt;&lt;td&gt;&lt;div&gt;world&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;'

turns any list, dictionary, etc into decent looking html.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.MENU-class.html" class="summary-name">MENU</a><br />
      Used to build menus...
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.web2pyHTMLParser-class.html" class="summary-name">web2pyHTMLParser</a><br />
      obj = web2pyHTMLParser(text) parses and html/xml text into 
        web2py helpers.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.html.MARKMIN-class.html" class="summary-name">MARKMIN</a><br />
      For documentation: 
        http://web2py.com/examples/static/markmin.html
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html-module.html#xmlescape" class="summary-sig-name">xmlescape</a>(<span class="summary-sig-arg">data</span>,
        <span class="summary-sig-arg">quote</span>=<span class="summary-sig-default">True</span>)</span><br />
      returns an escaped string of the provided data</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#xmlescape">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html-module.html#URL" class="summary-sig-name">URL</a>(<span class="summary-sig-arg">a</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">c</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">f</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">r</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">args</span>=<span class="summary-sig-default"><code class="variable-group">[</code><code class="variable-group">]</code></span>,
        <span class="summary-sig-arg">vars</span>=<span class="summary-sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>,
        <span class="summary-sig-arg">anchor</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">extension</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">env</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">hmac_key</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">hash_vars</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">_request</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">scheme</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">host</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">port</span>=<span class="summary-sig-default">1</span>)</span><br />
      generate a URL

example::

    &gt;&gt;&gt; str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#URL">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html-module.html#verifyURL" class="summary-sig-name">verifyURL</a>(<span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">hmac_key</span>,
        <span class="summary-sig-arg">hash_vars</span>=<span class="summary-sig-default">True</span>)</span><br />
      Verifies that a request's args &amp; vars have not been tampered with by the user

:param request: web2py's request object
:param hmac_key: the key to authenticate with, must be the same one previously
                used when calling URL()
:param hash_vars: which vars to include in our hashing.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#verifyURL">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html-module.html#_gURL" class="summary-sig-name">_gURL</a>(<span class="summary-sig-arg">request</span>)</span><br />
      A proxy function for URL which contains knowledge of a given 
      request object.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#_gURL">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="XML_unpickle"></a><span class="summary-sig-name">XML_unpickle</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#XML_unpickle">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="XML_pickle"></a><span class="summary-sig-name">XML_pickle</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#XML_pickle">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html-module.html#embed64" class="summary-sig-name">embed64</a>(<span class="summary-sig-arg">filename</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">file</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">data</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">extension</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">image/gif</code><code class="variable-quote">'</code></span>)</span><br />
      helper to encode the provided (binary) data into base64.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#embed64">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html-module.html#test" class="summary-sig-name">test</a>()</span><br />
      Example:</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#test">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="markdown_serializer"></a><span class="summary-sig-name">markdown_serializer</span>(<span class="summary-sig-arg">text</span>,
        <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">attr</span>=<span class="summary-sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#markdown_serializer">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="markmin_serializer"></a><span class="summary-sig-name">markmin_serializer</span>(<span class="summary-sig-arg">text</span>,
        <span class="summary-sig-arg">tag</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">attr</span>=<span class="summary-sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#markmin_serializer">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="regex_crlf"></a><span class="summary-name">regex_crlf</span> = <code title="re.compile(r'[\r\n]')">re.compile(r'<code class="re-group">[</code>\r\n<code class="re-group">]</code>')</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="ON"></a><span class="summary-name">ON</span> = <code title="True">True</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="TAG"></a><span class="summary-name">TAG</span> = <code title="__TAG__()">__TAG__()</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="xmlescape"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">xmlescape</span>(<span class="sig-arg">data</span>,
        <span class="sig-arg">quote</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#xmlescape">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>returns an escaped string of the provided data</p>
  :param data: the data to be escaped :param quote: optional (default 
  False)
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="URL"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">URL</span>(<span class="sig-arg">a</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">c</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">f</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">r</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">args</span>=<span class="sig-default"><code class="variable-group">[</code><code class="variable-group">]</code></span>,
        <span class="sig-arg">vars</span>=<span class="sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>,
        <span class="sig-arg">anchor</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">extension</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">env</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">hmac_key</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">hash_vars</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">_request</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">scheme</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">host</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">port</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#URL">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <pre class="literalblock">

generate a URL

example::

    &gt;&gt;&gt; str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':1, 'q':2}, anchor='1'))
    '/a/c/f/x/y/z?p=1&amp;q=2#1'

    &gt;&gt;&gt; str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':(1,3), 'q':2}, anchor='1'))
    '/a/c/f/x/y/z?p=1&amp;p=3&amp;q=2#1'

    &gt;&gt;&gt; str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':(3,1), 'q':2}, anchor='1'))
    '/a/c/f/x/y/z?p=3&amp;p=1&amp;q=2#1'

    &gt;&gt;&gt; str(URL(a='a', c='c', f='f', anchor='1+2'))
    '/a/c/f#1%2B2'

    &gt;&gt;&gt; str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':(1,3), 'q':2}, anchor='1', hmac_key='key'))
    '/a/c/f/x/y/z?p=1&amp;p=3&amp;q=2&amp;_signature=5d06bb8a4a6093dd325da2ee591c35c61afbd3c6#1'

generates a url '/a/c/f' corresponding to application a, controller c
and function f. If r=request is passed, a, c, f are set, respectively,
to r.application, r.controller, r.function.

The more typical usage is:

URL(r=request, f='index') that generates a url for the index function
within the present application and controller.

:param a: application (default to current if r is given)
:param c: controller (default to current if r is given)
:param f: function (default to current if r is given)
:param r: request (optional)
:param args: any arguments (optional)
:param vars: any variables (optional)
:param anchor: anchorname, without # (optional)
:param hmac_key: key to use when generating hmac signature (optional)
:param hash_vars: which of the vars to include in our hmac signature
    True (default) - hash all vars, False - hash none of the vars,
    iterable - hash only the included vars ['key1','key2']
:param _request: used internally for URL rewrite
:param scheme: URI scheme (True, 'http' or 'https', etc); forces absolute URL (optional)
:param host: string to force absolute URL with host (True means http_host)
:param port: optional port number (forces absolute URL)

:raises SyntaxError: when no application, controller or function is
    available
:raises SyntaxError: when a CRLF is found in the generated url

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="verifyURL"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">verifyURL</span>(<span class="sig-arg">request</span>,
        <span class="sig-arg">hmac_key</span>,
        <span class="sig-arg">hash_vars</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#verifyURL">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <pre class="literalblock">

Verifies that a request's args &amp; vars have not been tampered with by the user

:param request: web2py's request object
:param hmac_key: the key to authenticate with, must be the same one previously
                used when calling URL()
:param hash_vars: which vars to include in our hashing. (Optional)
                Only uses the 1st value currently (it's really a hack for the _gURL.verify lambda)
                True (or undefined) means all, False none, an iterable just the specified keys

do not call directly. Use instead:

URL.verify(hmac_key='...')

the key has to match the one used to generate the URL.

    &gt;&gt;&gt; r = Storage()
    &gt;&gt;&gt; gv = Storage(p=(1,3),q=2,_signature='5d06bb8a4a6093dd325da2ee591c35c61afbd3c6')
    &gt;&gt;&gt; r.update(dict(application='a', controller='c', function='f'))
    &gt;&gt;&gt; r['args'] = ['x', 'y', 'z']
    &gt;&gt;&gt; r['get_vars'] = gv
    &gt;&gt;&gt; verifyURL(r, 'key')
    True
    &gt;&gt;&gt; verifyURL(r, 'kay')
    False
    &gt;&gt;&gt; r.get_vars.p = (3, 1)
    &gt;&gt;&gt; verifyURL(r, 'key')
    True
    &gt;&gt;&gt; r.get_vars.p = (3, 2)
    &gt;&gt;&gt; verifyURL(r, 'key')
    False

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_gURL"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_gURL</span>(<span class="sig-arg">request</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#_gURL">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>A proxy function for URL which contains knowledge of a given request 
  object.</p>
  Usage is exactly like URL except you do not have to specify 
  r=request!
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="embed64"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">embed64</span>(<span class="sig-arg">filename</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">file</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">data</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">extension</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">image/gif</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#embed64">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>helper to encode the provided (binary) data into base64.</p>
  :param filename: if provided, opens and reads this file in 'rb' mode 
  :param file: if provided, reads this file :param data: if provided, uses 
  the provided data
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="test"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">test</span>()</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#test">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  Example:
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> validators <span class="py-keyword">import</span> *
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> DIV(A(<span class="py-string">'click me'</span>, _href=URL(a=<span class="py-string">'a'</span>, c=<span class="py-string">'b'</span>, f=<span class="py-string">'c'</span>)), BR(), HR(), DIV(SPAN(<span class="py-string">&quot;World&quot;</span>), _class=<span class="py-string">'unknown'</span>)).xml()
<span class="py-output">&lt;div&gt;&lt;a href=&quot;/a/b/c&quot;&gt;click me&lt;/a&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class=&quot;unknown&quot;&gt;&lt;span&gt;World&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> DIV(UL(<span class="py-string">&quot;doc&quot;</span>,<span class="py-string">&quot;cat&quot;</span>,<span class="py-string">&quot;mouse&quot;</span>)).xml()
<span class="py-output">&lt;div&gt;&lt;ul&gt;&lt;li&gt;doc&lt;/li&gt;&lt;li&gt;cat&lt;/li&gt;&lt;li&gt;mouse&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> DIV(UL(<span class="py-string">&quot;doc&quot;</span>, LI(<span class="py-string">&quot;cat&quot;</span>, _class=<span class="py-string">'feline'</span>), 18)).xml()
<span class="py-output">&lt;div&gt;&lt;ul&gt;&lt;li&gt;doc&lt;/li&gt;&lt;li class=&quot;feline&quot;&gt;cat&lt;/li&gt;&lt;li&gt;18&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> TABLE([<span class="py-string">'a'</span>, <span class="py-string">'b'</span>, <span class="py-string">'c'</span>], TR(<span class="py-string">'d'</span>, <span class="py-string">'e'</span>, <span class="py-string">'f'</span>), TR(TD(1), TD(2), TD(3))).xml()
<span class="py-output">&lt;table&gt;&lt;tr&gt;&lt;td&gt;a&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;td&gt;c&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;d&lt;/td&gt;&lt;td&gt;e&lt;/td&gt;&lt;td&gt;f&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>form=FORM(INPUT(_type=<span class="py-string">'text'</span>, _name=<span class="py-string">'myvar'</span>, requires=IS_EXPR(<span class="py-string">'int(value)&lt;10'</span>)))
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.xml()
<span class="py-output">&lt;form action=&quot;&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;&lt;input name=&quot;myvar&quot; type=&quot;text&quot; /&gt;&lt;/form&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.accepts({<span class="py-string">'myvar'</span>:<span class="py-string">'34'</span>}, formname=None)
<span class="py-output">False</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.xml()
<span class="py-output">&lt;form action=&quot;&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;&lt;input name=&quot;myvar&quot; type=&quot;text&quot; value=&quot;34&quot; /&gt;&lt;div class=&quot;error&quot; id=&quot;myvar__error&quot;&gt;invalid expression&lt;/div&gt;&lt;/form&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.accepts({<span class="py-string">'myvar'</span>:<span class="py-string">'4'</span>}, formname=None, keepvalues=True)
<span class="py-output">True</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.xml()
<span class="py-output">&lt;form action=&quot;&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;&lt;input name=&quot;myvar&quot; type=&quot;text&quot; value=&quot;4&quot; /&gt;&lt;/form&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>form=FORM(SELECT(<span class="py-string">'cat'</span>, <span class="py-string">'dog'</span>, _name=<span class="py-string">'myvar'</span>))
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.accepts({<span class="py-string">'myvar'</span>:<span class="py-string">'dog'</span>}, formname=None, keepvalues=True)
<span class="py-output">True</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.xml()
<span class="py-output">&lt;form action=&quot;&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;&lt;select name=&quot;myvar&quot;&gt;&lt;option value=&quot;cat&quot;&gt;cat&lt;/option&gt;&lt;option selected=&quot;selected&quot; value=&quot;dog&quot;&gt;dog&lt;/option&gt;&lt;/select&gt;&lt;/form&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>form=FORM(INPUT(_type=<span class="py-string">'text'</span>, _name=<span class="py-string">'myvar'</span>, requires=IS_MATCH(<span class="py-string">'^\w+$'</span>, <span class="py-string">'only alphanumeric!'</span>)))
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.accepts({<span class="py-string">'myvar'</span>:<span class="py-string">'as df'</span>}, formname=None)
<span class="py-output">False</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> form.xml()
<span class="py-output">&lt;form action=&quot;&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;&lt;input name=&quot;myvar&quot; type=&quot;text&quot; value=&quot;as df&quot; /&gt;&lt;div class=&quot;error&quot; id=&quot;myvar__error&quot;&gt;only alphanumeric!&lt;/div&gt;&lt;/form&gt;</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>session={}
<span class="py-prompt">&gt;&gt;&gt; </span>form=FORM(INPUT(value=<span class="py-string">&quot;Hello World&quot;</span>, _name=<span class="py-string">&quot;var&quot;</span>, requires=IS_MATCH(<span class="py-string">'^\w+$'</span>)))
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">if</span> form.accepts({}, session,formname=None): <span class="py-keyword">print</span> <span class="py-string">'passed'</span>
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">if</span> form.accepts({<span class="py-string">'var'</span>:<span class="py-string">'test '</span>, <span class="py-string">'_formkey'</span>: session[<span class="py-string">'_formkey[None]'</span>]}, session, formname=None): <span class="py-keyword">print</span> <span class="py-string">'passed'</span></pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Wed Feb 16 15:04:30 2011
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
